module.exports = app => {
  const mongoose = app.mongoose
  const Schema = mongoose.Schema

  const UserSchema = new Schema({
    __v: {
      type: Number,
      select: false,
    },
    email: {
      type: String,
      required: true,
    },
    passwd: {
      type: String,
      required: true,
      select: false,
    },
    nickname: {
      type: String,
      required: true,
    },
    avatra: {
      type: String,
      required: false,
      default: '/user.png',
    },
  }, {
    timestamps: true,
  })

  return mongoose.model('User', UserSchema)
}
